<template>
	<!-- 20221227 -->
	<view class="user-config-wxpay-page">
		<!-- 页面内容 -->
		<view class="page-content">
			<form class="" @submit="formSubmit">
				<view class="margin-left-30 padding-right-30 flex align-center line-height-100 border-bottom-ed">
					<view class="width-40">
						<text class="tyIcon-weixin text-wechat text-40"></text>
					</view>
					<input class="margin-left-10 flex-one" name="name" :value="wxpay.name" placeholder="请输入微信实名认证姓名"
						placeholder-class="text-28 text-aa" />
				</view>

				<button form-type="submit"
					class="margin-top-40 margin-lr-30 line-height-90 radius-45 bg-main-gradient text-center text-32 text-ff">
					确认
				</button>
			</form>
		</view>
		<!-- 页面浮层 -->
		<view class="page-layer">
			
		</view>
	</view>
</template>

<script>
	import user from "../api/user.js"
	export default {
		data() {
			return {
				wxpay: ''
			}
		},

		onReady() {
			user.wxpay.getWxpay().then(res => {
				if (res.code === 0) {
					this.wxpay = res.data.wxpay
				}
			})
		},

		methods: {
			/**
			 * 提交信息
			 */
			formSubmit(e) {
				if (!e.detail.value.name) {
					this.cn.toast("请输入微信姓名")
					return false
				}

				let data = {
					name: e.detail.value.name
				}

				user.wxpay.updateWxpay(data).then(res => {
					if (res.code === 0) {
						this.cn.alert(res.msg).then(res => {
							uni.navigateBack({
								delta: 1
							})
						})
					}
				})
			}
		}
	}
</script>

<style>
	.text {
		width: 112rpx;
	}
</style>
